<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function findContentChildren(g, s) {
            g.sort((a, b) => a - b);
            s.sort((a, b) => a - b);
            let num = 0
            let index=s.length-1
            for(let i=g.length-1;i>=0;i--){
                if(index>=0&&s[index]>=g[i]){
                    num++
                    index--
                }
            }
            return num
        }
        console.log(findContentChildren([1,2,3],[1,1]))
    </script>
</body>
</html>